<?php
/**
The Model class extends the SQLQuery class which basically is an abstraction layer for the mySQL connectivity. 
Depending on your requirements you can specify any other DB connection class that you may require.
*/
class Model extends SQLQuery {
	protected $_model;

	function __construct() {
		
		//$databaseConfiguration = DB_CONFIG;
		global $databaseConfiguration;
		if(!$databaseConfiguration){
			throw new Exception("Could not retrieve the database configuration");
		}
		$db = $databaseConfiguration[IHELP_DATABASE_NAME];
		if(!$db){
			throw new Exception("Could not retrieve the desired database");
		}
		$host = $db[DB_HOST_PARAM];
		$user = $db[DB_USER_PARAM];
		$passwd = $db[DB_PASSWORD_PARAM];
		$database = $db[DB_NAME_PARAM];
		$this->connect($host,$user,$passwd,$database);
		$this->_model = get_class($this);
		$this->_table = strtolower($this->_model)."s";
	}

	function __destruct() {
	}
}